﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.PregnancyCommand;
using MediatR;
using static Microsoft.ApplicationInsights.MetricDimensionNames.TelemetryContext;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.PregnancyCommandHandler
{
    public class PregnancyAddCommandHandler : IRequestHandler<PregnancyAddCommand, int>
    {
        private readonly IPregnancyService _pregnancyService;
        public PregnancyAddCommandHandler(IPregnancyService pregnancyService)
        {
            _pregnancyService = pregnancyService;
        }

        public async Task<int> Handle(PregnancyAddCommand request, CancellationToken cancellationToken)
        {
            var add = await _pregnancyService.AddPregnancy(request.sheeppregnancies);
            return add;
        }
    }
}
